package com.vcc.data.mapper;

import com.mybatisflex.core.BaseMapper;
import com.vcc.data.entity.Wallet;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

@Mapper
public interface WalletMapper extends BaseMapper<Wallet> {

    @Select("select usable_quota from vcc_wallet where user_id = #{userId} and currency_id = #{currencyId}")
    BigDecimal findUsableQuotaByUserIdAndCurrencyId(@Param("userId") Long userId, @Param("currencyId") Long currencyId);

    @Select("select usable_quota from vcc_wallet where user_id = #{userId} and currency_code = #{currencyCode}")
    BigDecimal findUsableQuotaByUserIdAndCurrencyCode(@Param("userId") Long userId, @Param("currencyCode") String currencyCode);
}
